package com.sntk.registermanager.staff.domain.model;

import com.sntk.registermanager.common.domain.model.ValueObject;
import com.sntk.registermanager.common.exception.ObjectDisbaledException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName: Affiliation
 * @author: wgchao
 * @createTime: 2020/7/23 1:28 PM
 * @Description: 所属机构
 */
@Getter
@AllArgsConstructor
public class Affiliation extends ValueObject {

    //机构编号
    private String institutionNumber;

    //机构名称
    private String institutionName;

    private boolean disabled;

    public boolean normal(){
        return !this.disabled;
    }

    public void normalException(){
        if(!normal()){
            throw new ObjectDisbaledException(this.institutionName+"机构不可用");
        }
    }

}
